import { S } from '../../s';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSControlAction } from '../ipscontrol-action';
import { PSAjaxControlContainerImpl } from '../psajax-control-container-impl';
import { IPSDEEditForm } from '../form/ipsdeedit-form';
import { IPSDEWizardPanel } from './ipsdewizard-panel';
import { IPSDEWizard } from '../../dataentity/wizard/ipsdewizard';

export class PSDEWizardPanelImpl
  extends PSAjaxControlContainerImpl
  implements IPSDEWizardPanel
{
  get codeName(): string {
    return this.M.codeName;
  }

  protected finishpscontrolaction: IPSControlAction;
  getFinishPSControlAction(): IPSControlAction | null {
    if (this.finishpscontrolaction != null) return this.finishpscontrolaction;
    const value = this.M.getFinishPSControlAction;
    if (value == null) {
      return;
    }
    this.finishpscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.finishpscontrolaction;
  }

  protected initpscontrolaction: IPSControlAction;
  getInitPSControlAction(): IPSControlAction | null {
    if (this.initpscontrolaction != null) return this.initpscontrolaction;
    const value = this.M.getInitPSControlAction;
    if (value == null) {
      return;
    }
    this.initpscontrolaction =
      this.getPSControlHandler().findPSControlHandlerAction(value);
    return this.initpscontrolaction;
  }

  protected psdeeditforms: IPSDEEditForm[];
  getPSDEEditForms(): IPSDEEditForm[] | null {
    return (
      this.psdeeditforms ||
      (this.psdeeditforms = this.fillChildListModel(
        this.M.getPSDEEditForms,
        S._240,
      ) as IPSDEEditForm[])
    );
  }

  findPSDEEditForm(objKey: any): IPSDEEditForm | null {
    return this.getPSModel5(
      S._240,
      this.getPSDEEditForms(),
      objKey,
    ) as IPSDEEditForm;
  }

  protected psdewizard: IPSDEWizard;
  getPSDEWizard(): IPSDEWizard | null {
    return (
      this.psdewizard ||
      (this.psdewizard = this.fillObjectModel(
        S._212,
        this.M.getPSDEWizard,
        S._363,
      ) as IPSDEWizard)
    );
  }

  protected statepsappdefield: IPSAppDEField;
  getStatePSAppDEField(): IPSAppDEField | null {
    return (
      this.statepsappdefield ||
      (this.statepsappdefield = this.fillObjectModel(
        S._1,
        this.M.getStatePSAppDEField,
        S._364,
      ) as IPSAppDEField)
    );
  }

  get wizardStyle(): string {
    return this.M.wizardStyle;
  }

  get showActionBar(): boolean {
    return this.M.showActionBar;
  }

  get showStepBar(): boolean {
    return this.M.showStepBar;
  }
  get cls(): string {
    return 'PSDEWizardPanelImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._26b || cls == S._26c) return true;
    return super.instanceof(cls);
  }
}
